<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 1.排序函数
        let arr1=[28,30,1,3,5]
        arr1.sort((x,y)=>{return y-x})
        console.log(arr1)
        arr2=["a","ass","lalalalla"]
        arr2.sort((x,y)=>{
            return y.length-x.length
        })
        console.log(arr2)
        // 2.过滤数组函数
        arr3=[12,32,45,76,98,65,33]
        let res=arr3.filter((value,index,array)=>{
            if(value>20){
                return value
            }
        })
        console.log(res)
        let res2=arr3.filter(value=> value>50)
        console.log(res2)
        // 3.map函数
        let res3=arr3.map(value=>value+"小花")
        console.log(res3)
        // 4.增删改函数
        arr3.push(567)
        console.log(arr3)
        arr3.unshift(123)
        console.log(arr3)
        arr3.splice(1,2)
        console.log(arr3)
        arr3.splice(1,2,"vvv","aaa")
        console.log(arr3)
    </script>
</body>
</html>